package LC;

public class LC69 {
    public int mySqrt(int x) {
        int left = 0,right = x;
        while(left < right){
            int middle = left + ( right - left)/2;
            if(middle*middle==x){
                return middle;
            }else if(middle * middle < x){
                left = middle +1;
            }else{
                right = middle -1;
            }
        }
        return left;
    }
}
